package com.df.ez_game.server;


import io.netty.channel.Channel;
import io.netty.util.AttributeKey;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class UserSession {
    private String sessionId;
    private Channel channel;
    private Long userId;
    private String state;//connected,auth,disconnected

    private Map<EzAttribute, Object> attr = new HashMap<>();

    public <T> T getAttr(EzAttribute<T> key){
        Object o = attr.get(key.getKey());
        if(o==null){
            return null;
        }
        return (T)(o);
    }

}
